<?php
 
if ( function_exists("exec") AND $checkDump = @str_replace("mysqldump:","",exec("whereis mysqldump")) AND !empty($checkDump) )
{				
	$date = date("mdy-hia");
	$filename = "". App::getParam('backup.path') ."". App::getParam('db','name') ."-$date.sql";							
	@exec("mysqldump --skip-add-locks --disable-keys --skip-comments -h". App::getParam('db','host') ." -u". App::getParam('db','user') ." -p". App::getParam('db','pass') ." ". App::getParam('db','name') ." >". $filename ."");
	$sZipName = "". App::getParam('backup.path') ."".App::getParam('db','name')."-".$date."_sql.tar.gz";
	$zipline = "tar -czf ". $sZipName ." $filename";
	@shell_exec($zipline);
	if ( file_exists($sZipName) )
	{
		@unlink($filename);
		$this->_print("Database backup is now complete!", true);
	}
	else
	{
		$this->_print("Database backup has failed!", true);
	}
}

?>